'\" te
.\"  Copyright 1989 AT&T  Copyright (c) 1996 Sun Microsystems, Inc.  All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH POSTREVERSE 1 "May 13, 2017"
.SH NAME
postreverse \- reverse the page order in a PostScript file
.SH SYNOPSIS
.LP
.nf
\fBpostreverse\fR [\fB-o\fR \fIlist\fR] [\fB-r\fR] [\fIfile\fR]
.fi

.LP
.nf
\fB/usr/lib/lp/postscript/postreverse\fR
.fi

.SH DESCRIPTION
.LP
The \fBpostreverse\fR filter reverses the page order in files that conform to
Adobe's Version 1.0 or Version 2.0 file structuring conventions, and writes the
results on the standard output. Only one input \fBfile\fR is allowed and if no
\fBfile\fR is specified, the standard input is read.
.sp
.LP
The \fBpostreverse\fR filter can handle a limited class of files that violate
page independence, provided all global definitions are bracketed by
\fB%%BeginGlobal\fR and \fB%%EndGlobal\fR comments. In addition, files that
mark the end of each page with \fB%%EndPage: label ordinal\fR comments will
also reverse properly, provided the prologue and trailer sections can be
located. If \fBpostreverse\fR fails to find an \fB%%EndProlog\fR or
\fB%%EndSetup\fR comment, the entire \fBfile\fR is copied, unmodified, to the
standard output.
.sp
.LP
Because global definitions are extracted from individual pages and put in the
prologue, the output file can be minimally conforming, even if the input
\fBfile\fR was not.
.SH OPTIONS
.ne 2
.na
\fB\fB-o\fR\fI list\fR\fR
.ad
.RS 11n
Select pages whose numbers are given in the comma-separated \fIlist\fR. The
\fIlist\fR contains single numbers \fIN\fR and ranges \fIN1 \fR\(mi \fIN2\fR. A
missing \fIN1\fR means the lowest numbered page, a missing \fIN2\fR means the
highest. The page range is an expression of logical pages rather than physical
sheets of paper. For example, if you are printing two logical pages to a sheet,
and you specified a range of \fB4\fR, then two sheets of paper would print,
containing four page layouts. If you specified a page range of \fB3-4\fR, when
requesting two logical pages to a sheet; then \fIonly\fR page 3 and page 4
layouts would print, and they would appear on one physical sheet of paper.
.RE

.sp
.ne 2
.na
\fB\fB-r\fR\fR
.ad
.RS 11n
Do not reverse the pages in \fBfile\fR.
.RE

.SH EXAMPLES
.LP
\fBExample 1 \fRExamples of \fBpostreverse\fR.
.sp
.LP
o select pages 1 to 100 from \fBfile\fR and reverse the pages:

.sp
.in +2
.nf
\fBexample% postreverse \fR\fB-o1\fR\fB\(mi100 \fR\fBfile\fR
.fi
.in -2
.sp

.sp
.LP
To print four logical pages on each physical page and reverse all the pages:

.sp
.in +2
.nf
\fBexample% postprint \fR\fB-n4\fR\fB \fR\fBfile\fR | postreverse
.fi
.in -2
.sp

.sp
.LP
To produce a minimally conforming file from output generated by \fBdpost\fR
without reversing the pages:

.sp
.in +2
.nf
\fBexample% dpost \fR\fBfile\fR | postreverse \fB-r\fR
.fi
.in -2
.sp

.SH EXIT STATUS
.LP
The following exit values are returned:
.sp
.ne 2
.na
\fB\fB0\fR\fR
.ad
.RS 12n
Successful completion.
.RE

.sp
.ne 2
.na
\fBnon-zero\fR
.ad
.RS 12n
An error occurred.
.RE

.SH SEE ALSO
.LP
.BR download (1),
.BR dpost (1),
.BR postio (1),
.BR postprint (1),
.BR attributes (7)
.SH NOTES
.LP
No attempt has been made to deal with redefinitions of global variables or
procedures. If standard input is used, the input \fBfile\fR will be read three
times before being reversed.
